import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'
import GoodsDetail from '../views/goods/detail.vue'
import { routeTransition } from './router-helper'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'HomeView',
      component: HomeView,
      meta: {
        level: 0,
      },
    },
    {
      path: '/goods-detail',
      name: 'goodsDetail',
      component: GoodsDetail,
      // component: () => import('../views/goods/detail.vue'),
      meta: {
        level: 1,
      },
    },
    {
      path: '/login',
      name: 'login',
      component: () => import('../views/user/login.vue'),
      meta: {
        level: 1,
      },
    },
    {
      path: '/order',
      name: 'orderDetail',
      component: () => import('../views/order/detail.vue'),
      meta: {
        level: 1,
      },
    },
    {
      path: '/record',
      name: 'recordDetail',
      component: () => import('../views/record/detail.vue'),
      meta: {
        level: 1,
      },
    },
  ],
})
routeTransition(router)
export default router
